Swift 6.2 Approachable Concurrency Migration for NetworkKit #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📋 Summary
This PR migrates NetworkKit to Swift 6.2 with Approachable Concurrency support, enabling strict concurrency checking while maintaining full backward compatibility with all existing API patterns (async/await, Combine, closures).
🎯 Motivation
Adopt Swift 6.2's "Approachable Concurrency" features (SE-0461)
Enable strict concurrency checking for data-race safety
Demonstrate modern Swift concurrency patterns
Prepare codebase for conference talk on Swift 6.2 concurrency
🔧 Changes Made
Updated swift-tools-version from 5.8 to 6.0
Enabled StrictConcurrency feature flag
Enabled ApproachableConcurrency feature flag (Swift 6.2)
Enabled InternalImportsByDefault experimental feature
Applied concurrency features to both main and test targets
EndPoint: Added Sendable conformance with documentation
NetworkError: Added Sendable conformance, fixed default → explicit case .unknown
RequestMethod: Added Sendable conformance, standardized PATCH → patch naming
Added Sendable protocol conformance
Added Sendable constraints to all generic type parameters (T: Decodable & Sendable)
Enhanced documentation with SE-0461 isolation context notes
Added sendRequestWithContinuation method to demonstrate bridging pattern
Organized methods with clear MARK comments by pattern type
Thread-Safety Improvements
Added @unchecked Sendable conformance (manually verified safe)
Replaced URLSession.shared with immutable instance property
Added dependency injection via init(configuration:)
Added convenience init() for default configuration
Error Handling Improvements
Replaced try? with proper do-catch blocks for better error propagation
Fixed preconditionFailure in Combine method → returns Fail publisher
Improved variable naming (avoided shadowing: response → httpResponse)
Corrected error types (.invalidURL → .unexpectedStatusCode where appropriate)
Code Organization
Converted extension methods to private methods
Changed fileprivate → private for better encapsulation
Added comprehensive method documentation
Added MARK comments for code navigation